<style>
.label-gray {
	line-height:2.2;
	background-color:#f5f7fb;
	border: 1px solid #f5f7fb;
	color:#999;
	margin-right:0.3rem;
    font-size: 100%;
}
.label-gray.active {
	background-color:#fff;
	color:{{main.syscolor || '#7c1cc9'}};
	border: 1px solid {{main.syscolor || '#7c1cc9'}};
}
.fui-tab-scroll .item a {color:#333;font-weight:400}
.fui-tab-scroll .item.on,.fui-tab-scroll .item.on a{color:{{main.syscolor || '#7c1cc9'}};}
.fui-tab-scroll .item.on:before {background:#f2f2f2;}
</style>
<div ng-if="pagedata.showvoices" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="height: auto;overflow: hidden;">
		<i class="closed icon icon-cuowu" style="top: -2rem;left:90%" ng-click="pagedata.showvoices=false"></i>
		<div class="radius">
		<div class="fui-tab-scroll" style="padding-bottom:0;height:2.4rem">
			<div ng-class="{'item':1,'on':pagedata.params.voicesex==0}"><a href="javascript:" ng-click="pagedata.params.voicesex=0;pagedata.get_list('/index/getvoices/',true)">全部</a></div>
			<div ng-class="{'item':1,'on':pagedata.params.voicesex==1}"><a href="javascript:" ng-click="pagedata.params.voicesex=1;pagedata.get_list('/index/getvoices/',true)">男生</a></div>
			<div ng-class="{'item':1,'on':pagedata.params.voicesex==2}"><a href="javascript:" ng-click="pagedata.params.voicesex=2;pagedata.get_list('/index/getvoices/',true)">女生</a></div>
		</div>
		<div class="fui-tab-scroll" style="padding-bottom:0;height:2.4rem">
			<div ng-class="{'item':1,'on':pagedata.params.yuyuantype==0}"><a href="javascript:" ng-click="pagedata.params.yuyuantype=0;pagedata.get_list('/index/getvoices/',true)">全部语言</a></div>
			<div ng-class="{'item':1,'on':pagedata.params.yuyuantype==key}" ng-repeat="(key,title) in pagedata.yuyuantypes"><a href="javascript:" ng-click="pagedata.params.yuyuantype=key;pagedata.get_list('/index/getvoices/',true)">{{title}}</a></div>
		</div>
		<div class="fui-cell-group" style="max-height:30rem;overflow-y:scroll;margin-top:0;-webkit-overflow-scrolling: touch;padding-bottom: 1rem;">
		<div class="fui-cell" ng-repeat="item in pagedata.voices" ng-click="pagedata.showvoices=false;pagedata.post.voiceid=item.id;pagedata.post.voicetitle=item.title;pagedata.post.languagetitle=item.languagetitle;pagedata.selectvoice(item)">
		<div class="fui-cell-label" style="width:3rem">
			<img class="img-circle" style="border-radius:100%;height: 2.5rem;width: 2.5rem;" ng-src="{{tomedia(item.logo) || '../addons/jy_aiagent/resource/images/voice.png'}}">
		</div>
		<div class="fui-cell-text">
			<div class="text">
			{{item.title}} 
			</div>
			<div class="text" style="font-size:0.65rem">
			{{item.sex==1 ?'男':'女'}} | <span class="fui-tag fui-tag-danger" style="background:linear-gradient(to right,rgba(244,221,187,0.6),rgba(235,216,174,1));color:#512f0a;width:auto;font-weight:400;font-size:0.5rem">{{item.languagetitle||'普通话'}}</span>
			</div>
		</div>
		</div>
		</div>
		</div>
		</div>
	</div>
</div>
<script>
scope.pagedata.get_list=function(isfirst){
		if(!scope.pagedata.params){
			scope.pagedata.params={};
		}
		if(isfirst){
			scope.pagedata.params.vpage=1;
			scope.pagedata.voices=[];
			scope.pagedata.loaded=false;
		}else if(scope.pagedata.loaded || scope.pagedata.loading){
			return;
		}
		var url='/index/getvoices/';
		scope.pagedata.loading=true;
		$('#loading_show').show();
		if(typeof(url)!='object'){
			url=scope.tool.links(url);
		}
		var query=scope.made_query(scope.pagedata.params);
		if(url.query){
			url.query+='&'+query;
		}else{
			url.query=query;
		}
		//console.log('query');console.log(query);
		scope.get(url,function(res){
			//console.log(res);
			scope.pagedata.loading=false;
			$('#loading_show').hide();
			if(!scope.pagedata.voices || isfirst){
				scope.pagedata.voices=[];
			}
			if(res=='none'){
				scope.pagedata.loaded=true;
				return;
			}
			if(!Array.isArray(res)){
				var voices=res.list?res.list:[]
			}else{
				var voices=res
			}
			if(voices.length==0 || (scope.pagedata.psize && voices.length<scope.pagedata.psize)){
				scope.pagedata.loaded=true;
			}
			if(voices && voices != 'null' && voices != 'undefined'){
				for(let key in voices){
					scope.pagedata.voices.push(voices[key]);
				}
			}
			if(scope.pagedata.params){
				scope.pagedata.params.vpage++;
			}
		});
}
scope.pagedata.get_list(true);
scope.pagedata.scroll_bottom=function(){
	scope.pagedata.get_list();
}
scope.pagedata.selectvoice=function(item){
	if(scope.pagedata.isaddagent){
		scope.post_json('jy_aiagent/agent/addagent/',scope.pagedata.post);
	}
}
</script>